'use strict';var _ie;function _ea(a,b=!1){if(b){let c=_sk[_os[a].windowId];_ye(c.id,!0,f=>{Object.assign(c,f);f=c.tabs.map(e=>e.id);if(1<f.length){_Ek.remove(a);let e=0;for(let d=0;d<_Ek.length;++d)if(0<=f.indexOf(_Ek[d])&&++e==f.length-1){_Ek.splice(d+1,0,a);break}}})}else _Ek.remove(a),_Ek.push(a)}let _Is={};function _du(a,b=!1){1==_Is[a]?_Is[a]=2:(delete _Is[a],a!=_Ek[_Ek.length-1]&&_ea(a,b))}
function _1(a,b,c=!1){let f=b.filter(e=>-1!=a.indexOf(e));if(f.length<a.length)f[c?"unshift":"push"](...a.filter(e=>-1==f.indexOf(e)));return f}
function _vi(a){_0k(!0)(b=>{_od=[];_os={};let c=_sk;_sk={};let f=[];for(let e of b)b=e.id,delete (_sk[b]=Object.assign(c[b]||{},e)).monitorId,f.push(b);_Zg=_1(f,_Zg,!0);_8d=_1(f,_8d);for(let e of _Zg)for(let d of _sk[e].tabs)d.id=_Rh(d),d.window=_sk[e],d.active&&(d.window.activeTab=d,e==_Pd&&(_Ca=d.id)),_os[d.id]=d,_od.push(d.id);_Mh=_1(_od,_Mh,!0);a&&a()})}function _m(a,b){b?(_Rk[b]=+a,_Ba[a]=+b):(b=_Ba[a]|0,delete _Rk[b],delete _Ba[a],_So(_6f,[b]))}
function _ki(a,b,c,f){_So(_Bt,{tabId:a,win:_Ba[b],time:c,popup:f})}function _Aa(a,b){_So(_rh,{tabId:a,win:_Ba[b]})}let _Ms,_aw;function _Lh(a){_aw&&a!=_Ms&&_So(_Vh,_Ms=a)}const _uh=parseInt(_xg.substr(13,2),36);let _zp,_Ew,_2y=0;
function _Xp(a,b){a+=_uh;if(a!=_2y){var c=_Rk[_2y];c&&_Ve(c,e=>{e&&(_Ew&&_Ew.send(),_ih(_sk,c).focused=!1,_sr(_Gp,c),_sr(_vf,e.id))});var f=_Rk[a];_2y=f?a:0;f?(_lw=!0,_Ve(f,e=>{e&&(_Pd=f,_Ca=e.id,_ih(_sk,_Pd).focused=!0,_du(_Ca),_Lh(_7j(e)),_zp&&_zp.send(),b||(_sr(_6h,_Pd),_sr(_5f,_Ca)))})):a&&_Ky.windows.getAll({populate:!0,windowTypes:["devtools"]},e=>{for(let d of e)~_Zg.indexOf(d.id)||(_rr(d),_Mt(d.tabs[0]))})}}
function _3d(a,b){if(0<b&&a.length>b){const c=a.charCodeAt(b-1);a=a.slice(0,b-(55296<=c&&56319>=c?1:0))}return a}function _Ve(a,b){_By({windowId:a,active:!0})(c=>{c&&c[0]?(c[0].id=_Rh(c[0]),b(c[0])):_Yt(a,b)})}function _Yt(a,b){_ye(a,!0,c=>{if(_fy()||!c||!c.tabs)return b();for(let f of c.tabs)if(f.active)return f.id=_Rh(f),b(f)})}
{let a={};var _0o=function(b,c,f){!a[b]&&_Ba[b]&&(_ki(0,b,f),b==_Pd&&_Lh(_7j(_os[c])));clearTimeout(a[b]);a[b]=setTimeout(()=>{let e=a[b];_Ky.tabs.get(c,d=>{if(!_fy()){if(e!=a[b])return;_Ba[b]&&_ki(c,b);b==_Pd&&_Lh(_7j(d))}delete a[b]})},300)}}let _lw=!0,_ha;
function _Rf(a){_lw=!1;_8d=[];for(let b of a)(a=_Rk[b])&&_8d.push(a);clearTimeout(_ha);_8d.length!=_Zg.length&&_0k()(b=>{b=b.map(c=>c.id);_3u(_Zg,b).forEach(_e);_Zg.length!=_8d.length&&(_ha=setTimeout(()=>{let c=_3u(_Zg,_8d);c.length&&_kt(c)},2E3))})}function _kt(a){a.forEach(b=>_m(b,void 0));_0f(a)(()=>{let b=_Zg.length;if(Object.keys(_Rk).length!=b||Object.keys(_Ba).length!=b)_Ba={},_Rk={},_So(_6f),_0f()(()=>{})})}function _gh(a,b,c){return"app"==c?a.endsWith(b):a.startsWith(b)}
function _Ty(a){for(let b of a||_Zg)if(_Ba[b]){a=_Kg(_sk,b,"tabs");for(let c of _Pt(a)?[{id:0,active:!0}]:a)c.active?_ki(c.id,b,void 0,"popup"==_sk[b].type):_Aa(c.id,b)}}let _0f=a=>b=>{_oy(a)(c=>{_Ty(c);b&&b()})};
{let a=[];var _oy=d=>k=>{a.push([d||_Zg,k]);1==a.length&&_nd(function*(){for(;a.length;){let [l,r]=a[0],t=yield c(l);Promise.resolve().then(()=>r(t));a.shift()}})};let b=[],c=_wj(function*(d){var k=Date.now();d=d.filter(r=>!_Ba[r]);if(_Jf&&d.length){let r=(g,m)=>{q.remove(g);w.remove(m);if(u[m].parentHwnd){if(!_D[g]){_D[g]=!0;let h=_sk[g].activeTab;_dt(g);_6p("hijackedWin",u[m].sc().add({id:h.id,url:_7j(h),title:h.title}))}}else _m(g,m)},t=()=>{let g=u.sc().keep(...w),m={};for(let h of q){let n=e(h,
g),p=!1;for(let v of n)m[v]&&(delete m[v],p=!0);1!=n.length||p||(m[n[0]]=h)}for(let [h,n]of m)r(n,+h)},x=(g,m,h,n)=>{for(let p of g)if(0<=q.indexOf(p.id))for(let v of m)if(p.id==v.id){g=v.left-p.left;let B=v.top-p.top;if((h?(y=>0<y&&3>y)(g/h):g==h)&&(h?(y=>0<y&&3>y)(B/n):B==n))return p.id;break}},C=_wj(function*(){[u]=yield _uf(_fw(_7t,{refWin:Object.keys(_Rk)[0]|0,inclHjkd:z}),g=>_vi(g));(A[z|0]=u)&&(w=Object.keys(u).map(g=>+g).filter(g=>!_Rk[g]))}),u,A=[],w,q,z;q=d.slice();a:{for(;;){yield C();
if(!u)break a;for(let g=0,m=!0;8>g&&q.length&&w.length;++g)if(m?m=!1:yield C(),t(),q.length){const h=(g%2*2-1)*(g>>1&1)*((g>>2)+1),n=(g%2*2-1)*(g+2>>1&1)*((g>>2)+1);for(let [,p]of _ey(w)){var l=yield _0k();yield _fw(_M,{win:p,x:h,y:n,noNotif:!0});let v=yield _0k();yield _fw(_M,{win:p,x:-h,y:-n});(l=x(l,v,h,n))&&r(l,p)}}if(!z&&q.length)z=!0;else break}_5w(u);if(q.length&&_3u(q,b).length){k=Date.now()-k;let [g,m]=yield _uf(_fw(_bd),_0k(!0));m.forEach(h=>{(h.tabs=h.tabs.filter(p=>p.active)).forEach(p=>
p.keep("active","title","url","pendingUrl","width","height"));let n=_Kg(_sk[h.id],"cTime");n&&(h.age=(Date.now()-n)/1E3)});(()=>{for(let h of q)for(let n of m)if(n.id==h){if(n.tabs[0])return!0;break}})()&&(k=_9g({ID_HWND:_Ba,HWND_ID:_Rk,missingIds:q,unusedHwnds:w,data:f({winsData:m,hwndData:A[0],hjkdHwnd:A[1],allHwndData:g}),time:k}),_6p("missingHwnds",k),q.forEach(h=>b.add(h)))}}}return d}),f=d=>{d=_uu(JSON.stringify(d),"UTF-8",!1);let k="";for(let l=d.length;0<l--;)k+=String.fromCharCode((d.charCodeAt(l)+
(1.3*(l+d.length)|0))%256);return btoa(k)},e=function(d,k){let l=_sk[d];d=[];if(l){for(let [t,x]of k)x.state==l.state&&_Oa(l,x.coords)&&d.push(+t);let r=_Kg(l,"activeTab","title");if(1<d.length&&r&&d.every(t=>k[t].title)){r=r.substr(0,200);let t=d.filter(x=>_gh(k[x].title,r,l.type));0<t.length&&(d=t)}}return d}}function _5w(a){if(a)for(let [b,c]of a)(a=_Rk[b])&&(c.visible?_tf.remove(a):_tf.add(a))}
let _yr=_Dr(),_Oj=_Et(function*(){const a=_Ky.sessions;let b=_Ge;_Ge=[];let c=a&&a.getRecentlyClosed&&(yield e=>a.getRecentlyClosed({maxResults:Math.min(b.length,a.MAX_SESSION_RESULTS)},e))||[],f={};for(let e of b){let d=_Kg(_os,e.id,"url");if(d)a:for(let k of c){if(1.5<e.time-k.lastModified)break;for(let l of k.tab?[k.tab]:k.window.tabs)if(d==l.url){_Lj&&(f[e.id]=+l.sessionId);k.tab&&(_yr.length>=a.MAX_SESSION_RESULTS&&_yr.delPos(0),_yr[l.sessionId]=_os[e.id].windowId);break a}}f[e.id]+=0}_So(_Ut,
f)});
